package com.ayoka.utils;


import java.util.Observable;

/**
 * 倒计时通知事件，上层界面可以订阅此事件
 */
public class CourseEvent extends Observable {


    private volatile static CourseEvent instance;

    private CourseEvent() {
    }

    public static CourseEvent getInstance() {
        if (instance == null) {
            synchronized (CourseEvent.class) {
                if (instance == null) {
                    instance = new CourseEvent();
                }
            }
        }
        return instance;
    }

    /**
     *  设置课程听完
     */
    public void notifyOCourseChanged() {
        setChanged();
        notifyObservers();
    }

    /**
     * 清理监听
     */
    public void destroy() {
        deleteObservers();
        instance = null;
    }
}
